﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
using CacheProxy;
using System.Diagnostics;
using System.Threading;

namespace CacheUnitTest
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            var r = Parallel.For(0, 20, (i) => {
                string result = FallbackTaskQueue.EnqueueTask<string>((k) =>
                {
                    Thread.Sleep(500);
                    return k.ToString();
                }, i.ToString());
                Debug.WriteLine(i+":"+result);
            });
            while(!r.IsCompleted)
            {
                Thread.Sleep(10);
            }
            Assert.IsTrue(true);
        }
    }
}
